Skip to content

fix(plugin): copy lib/ directory alongside hook in session-start#1103

Merged
JeremyDev87 merged 1 commit into
masterfrom
fix/session-start-copy-lib-1102
Mar 29, 2026
Merged

fix(plugin): copy lib/ directory alongside hook in session-start#1103
JeremyDev87 merged 1 commit into
masterfrom
fix/session-start-copy-lib-1102

Conversation

@JeremyDev87

Copy link
Copy Markdown
Owner

Summary

  • session-start.py only copied the mode-detect hook to ~/.claude/hooks/ but not the lib/ directory containing hud_state.py
  • This caused the hook's HUD state update to silently fail (ImportError caught by bare except), leaving the TUI sidebar stuck on "idle"
  • Extract _install_hook_with_lib() to copy both hook file and lib/ directory together
  • Use shutil.copytree with dirs_exist_ok=True and __pycache__ exclusion
  • Add 3 test cases for the new function

Test plan

  • test_copies_lib_dir_when_installing_hook — verifies lib/ is copied alongside hook
  • test_updates_lib_dir_when_already_exists — verifies lib/ is updated on reinstall
  • test_works_when_source_has_no_lib — verifies graceful handling when no lib/
  • All 25 existing tests pass (no regression)
  • Manual verification: symlinked lib/ → TUI sidebar updates on mode change

Closes #1102

session-start.py only copied the mode-detect hook to ~/.claude/hooks/
but not the lib/ directory containing hud_state.py. This caused the
hook's HUD state update to silently fail (ImportError caught by bare
except), leaving the TUI sidebar stuck on "idle" for all modes.

- Extract _install_hook_with_lib() to handle hook + lib/ copy together
- Use shutil.copytree with dirs_exist_ok=True for lib/ updates
- Exclude __pycache__/*.pyc from copytree to avoid stale bytecode
- Add 3 tests (normal copy, update existing, no lib/ graceful)

Closes #1102
@vercel

vercel Bot commented Mar 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Mar 29, 2026 11:44am

@JeremyDev87 JeremyDev87 self-assigned this Mar 29, 2026
@JeremyDev87 JeremyDev87 merged commit 071d16f into master Mar 29, 2026
28 checks passed
@JeremyDev87 JeremyDev87 deleted the fix/session-start-copy-lib-1102 branch March 29, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(plugin): session-start hook does not copy lib/ dependencies to ~/.claude/hooks/

1 participant